<?php 
if(!isset($_SESSION)) 
{ 
session_start(); 
} 
try{
		include 'showscreen.php';
		set_time_limit(0);
		$idmonitor = $_REQUEST['monitorid'];
		$winW = $_REQUEST['winW'];
		$winH = $_REQUEST['winH'];
		$numb= $_REQUEST['numb'];
		$bd=$_REQUEST['bd'];
		$kt=$_REQUEST['kt'];
		$cot=sqrt($numb);
		$onewidth=($winW-30)/$cot;
		$oneheight=($winH-120)/$cot;
		$sl=count($_SESSION['mcar']);
		$mfont=($onewidth / 21)."px";
		?>
		<table width="100%" height="88%" border="0" style="background:none; cellsapcing:5px;;border-collapse: separate;" onmousedown="return false" onselectstart='return false;'>
			<?php 
				if($sl>0){
					$vitri=0;
					for($i=$bd;$i<$kt;$i++){
						$CT = unserialize (serialize ($_SESSION['mcar'][$i+1]));
						if($vitri%$cot==0){
							?>
							<tr>
							<?php 
						}
							?>
							<td style="background-size:<?php echo $onewidth."px"?> <?php echo $oneheight."px"?>;background-repeat:no-repeat;padding-bottom: 0.1%">
								<div  id="<?php echo 'hinh'.($i+1)?>" ondblclick="show_prenext_car(<?=$numb?>,<?=$idmonitor?>,<?=$CT->id?>,<?=$bd?>,<?=$kt?>,<?=($i+1)?>);" style="border-bottom-style: hidden;width:<?php echo $onewidth."px"?>;height:<?php echo $oneheight."px"?>;position:relative;">
									<div style="position:absolute;">
										<?php 
										if($CT->pos==0){
											?>
											<img src="images/noimage.jpg" style='width:<?php echo $onewidth."px"?>;height:<?php echo $oneheight."px"?>;border: 1px solid #CFD6D9;border-radius: 2px;' onerror="this.src='images/noimage.jpg';" />
											<?php 
										}else{
											?>
											<img src="<?=$CT->image?>" style='width:<?php echo $onewidth."px"?>;height:<?php echo $oneheight."px"?>;border: 1px solid #CFD6D9;border-radius: 2px;' onerror="this.src='images/noimage.jpg';" />
											<?php 
										}
										?>
									</div>
									<div style="position:absolute;">
									<table style="border-bottom-style: hidden;background:none; padding:1%;width:<?php echo $onewidth."px"?>;height:<?php echo $oneheight."px"?>;" border="0">
										<tr >
											<td valign="top" >
												<table width="100%" border="0" style="background:none;border-bottom-style: hidden; ">
													<tr>
														<td align="left" valign="top"  style="color: yellow;font-size:<?php echo $mfont;?>;"><?php echo $CT->name?></td>
														<td align="right" valign="top">
															<?php if ($CT->light == 1) {?>
											              	<img src='images/circle-green.png' style='width:13px;height:13px;'>
											              	<?php }else if ($CT->light == 0){?>
											              		<img src='images/circle_red.png' style='width:13px;height:13px;'>
											              <?php }?>
														</td>
													</tr>
												</table>
											</td>
										<tr>
										<tr>
											<td valign="bottom">
												<table  width="100%"  border="0"  style="background:none;border-bottom-style: hidden; ">
													<tr >
														<td colspan="2" align="right"   style="color: yellow;font-size:<?php echo $mfont;?>;"><?=$CT->distance?></td>
													</tr>
													<tr>
														<td align="left"  style="color: yellow;font-size:<?php echo $mfont;?>;"><?=$CT->car_datetime?></td>
														<td align="right"  style="color: yellow;font-size:<?php echo $mfont;?>;"><?=$CT->vstriger_type?></td>
													<tr>
													<tr valign="bottom" >
														<td align="left"  style="color: yellow;font-size:<?php echo $mfont;?>;"><?=$CT->platecar?></td>
														<td align="right"  style="color: yellow;font-size:<?php echo $mfont;?>;">
															<?php 
												              	if($CT->pos==0){
												              		echo ($i+1);
												              	}else{
												              		echo $CT->pos;	
												              	}
												           ?>
														</td>
													<tr>
												</table>
											</td>
										</tr>
									</table>
									</div>
								</div>
							</td>
							<?php 
						$vitri++;
						if($vitri%$cot==0){
							?>
							</tr>
							<?php 
						}
					}
				}
			?>
		</table>
		<?php 
}catch(Exception $e){
	echo $e->getMessage();
}?>
